<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function foo(){
        if(true){
            var a='hello'
        }
        console.log(a);
        function foo1(){
            console.log(a)
        }
        foo1();
    }
    foo();
    console.log(a);
    </script>
</head>
<body>
    
</body>
</html>